fix(vfs): handle ./ prefix in path resolution#1142
Merged
Conversation
Normalize paths with `.` and `..` components in: - Interpreter::resolve_path (used by redirections, test builtin, script exec) - Interpreter test-command inline resolve lambda - Glob expand_glob directory resolution - PosixFs (all FileSystem trait methods) Closes #1114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.and..path components inInterpreter::resolve_path, glob directory resolution, andPosixFsmethods./filenameresolves identically tofilenamerelative to cwd across all VFS operations (ls, cat, redirections, test builtin, globs)Changes
Interpreter::resolve_path: Now callsnormalize_pathon the joined result, fixing redirections (> ./file), script execution (./script.sh), and thetestbuiltin ([ -f ./file ])Interpretertest-command lambda: Same normalization for inline path resolution in[/testglob::expand_glob: Normalizes the directory path when pattern has a relative prefix like./PosixFs: AllFileSystemtrait methods now normalize input paths before delegating to the backend, ensuring customFsBackendimplementations work correctly with.and..componentsTest plan
test_dot_slash_prefix_ls—ls ./fileworkstest_dot_slash_prefix_glob—echo ./*.htmlworkstest_dot_slash_prefix_cat—cat ./fileworkstest_dot_slash_prefix_redirect—echo x > ./fileworkstest_dot_slash_prefix_test_builtin—test -f ./fileworkstest_posix_normalize_dot_slash_prefix— PosixFs handles./pathstest_posix_normalize_preserves_semantics— parent-exists checks still workCloses #1114